package primenumbers;

import java.util.Scanner;
import javax.swing.JOptionPane;

public class Primenumbers {
    public static void main(String[] args) {
        int primeNumber, count = 0;
        // Scanner input = new Scanner(System.in);
        
        String t = JOptionPane.showInputDialog(null, "Ievadi skaitli, līdz kādam"
                + "aprēķināt pirmskaitļus", "Pirmskaitļu kalkulators", JOptionPane.QUESTION_MESSAGE);
        primeNumber = Integer.parseInt(t);
       
        for(int i = 1; i < primeNumber; i++){
               
                boolean isPrime = true;
               
                for(int j = 2; j < i ; j++){
                       
                        if(i % j == 0){
                                isPrime = false;
                                // break;
                        }
                }
                if(isPrime) {
                        System.out.print(i + " ");
                        count++;
                }
        }
        System.out.print("\nCount: " + count);
        
    }
}
